﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SkyNote.Infrastructure
{
    public static class LogWriter
    {
        private static readonly ILog log = LogManager.GetLogger("SintaoFramework.Logger");
        private static readonly ILog workflowLog = LogManager.GetLogger("SintaoFramework.WorkflowLogger");
        public static ILog WorkflowLog
        {
            get
            {
                return LogWriter.workflowLog;
            }
        }
        public static void Log(string message, System.Exception ex = null)
        {
            if (!string.IsNullOrEmpty(message) || ex != null)
            {
                if (null == ex)
                {
                    LogWriter.log.Info(message);
                }
                else
                {
                    LogWriter.log.Error(message, ex);
                }
            }
        }
        public static void Log(object obj)
        {
            if (null != obj)
            {
                LogWriter.log.Info(obj);
            }
        }
        public static void Error(System.Exception ex)
        {
            if (null != ex)
            {
                LogWriter.log.Error(ex.Message, ex);
            }
        }
    }
}